<?php
$areaLists = [
    1 => '桃城区',
    2 => '开发区',
    3 => '冀州区'
];
$priceLists = [
    1 => '1000元以下',
    2 => '1001-2000元',
    3 => '2001-3000元',
    4 => '3001元及以上'
];
$modeLists = [
    1 => '一室一厅',
    2 => '两室一厅',
    3 => '三室一厅',
    4 => '三室两厅'
];
$area = isset($_GET['area']) ? $_GET['area'] : '';
$price = isset($_GET['price']) ? $_GET['price'] : '';
$mode = isset($_GET['mode']) ? $_GET['mode'] : '';
?>

<html>
<head>
    <title>搜索</title>
    <style>
        a{
            text-decoration: none;
            color: #555555;
            padding: 3px 5px;
            margin: 0 5px;
            display: inline-block;
        }
        a.active {
            color: red;
        }
    </style>
</head>
<body>
    <div>
        区域：
        <a href="/c5/search.php?area=&price=<?php echo $price;?>&mode=<?php echo $mode;?>"
           <?php if(empty($area)):?>class="active"<?php endif;?>
        >不限</a>
        <?php foreach($areaLists as $k => $v):?>
        <a href="/c5/search.php?area=<?php echo $k;?>&price=<?php echo $price;?>&mode=<?php echo $mode;?>"
           <?php if ($k == $area):?>class="active"<?php endif;?>
        ><?php echo $v;?></a>
        <?php endforeach;?>
    </div>
    <div>
        价格：
        <a href="/c5/search.php?area=<?php echo $area;?>&price=&mode=<?php echo $mode;?>"
           <?php if(empty($price)):?>class="active"<?php endif;?>
        >不限</a>
        <?php foreach($priceLists as $k => $v):?>
            <a href="/c5/search.php?area=<?php echo $area;?>&price=<?php echo $k;?>&mode=<?php echo $mode;?>"
               <?php if ($k == $price):?>class="active"<?php endif;?>
            ><?php echo $v;?></a>
        <?php endforeach;?>
    </div>
    <div>
        户型：
        <a href="/c5/search.php?area=<?php echo $area;?>&price=<?php echo $price?>&mode="
           <?php if(empty($mode)):?>class="active"<?php endif;?>
        >不限</a>
        <?php foreach($modeLists as $k => $v):?>
            <a href="/c5/search.php?area=<?php echo $area;?>&price=<?php echo $price?>&mode=<?php echo $k;?>"
               <?php if ($k == $mode):?>class="active"<?php endif;?>
            ><?php echo $v;?></a>
        <?php endforeach;?>
    </div>
</body>
</html>
